from django.db import models
from customer.models import Customer
from commodity.models import Commodity


# Create your models here.


# Create your models here.
class Order(models.Model):
    order_no = models.TextField(verbose_name='订单号')
    status = models.IntegerField(default=0)
    money = models.FloatField()
    subject = models.TextField(verbose_name='商品标题')
    create_time = models.DateTimeField(auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)
    commodity = models.ForeignKey(Commodity, on_delete=models.CASCADE, verbose_name='商品ID')
    user = models.ForeignKey(Customer, on_delete=models.CASCADE, verbose_name='用户ID')  # 订单是哪个用户的

    class Meta:
        db_table = 'order'
